<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>工厂方法</title>
    <script>
        var obj = {
            name:"孙悟空",
            age:18,
            gender:"男",
            sayName:function() {
                alert(this.name);
            }
        };
        function creat() {
            var obj = new Object();
            return obj;
        }
        var obj2 = creat();
    </script>
</head>
<body>
    
</body>
</html>